<template>
  <div>
    <el-table
        :data="tableData"
        style="width: 100%"
        :default-sort="{prop: 'date', order: 'descending'}"
    >
      <el-table-column prop="realName" sortable label="申述人" header-align="center" align="center"
                       width="180"></el-table-column>
      <el-table-column prop="createTime" header-align="center" align="center" label="申述时间"></el-table-column>
      <el-table-column prop="connect" header-align="center" align="center" label="申述内容"></el-table-column>
      <el-table-column label="操作" header-align="center" align="center">
        <template slot-scope="scope">
          <el-button size="small" style="background-color: #0096dc" @click="get(scope.row)">查看结果</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-dialog title="处理反馈" :visible.sync="dialogFormVisible">
      <el-card style="margin: 0 auto;
    background-color: rgba(255,255,255,0.3)">
        <span>处理时间</span><br>
        <span>{{ this.data.handleTime }}</span>
        <br>
        <span>反馈结果</span><br>
        <div>{{ this.data.handler }}</div>
      </el-card>
    </el-dialog>
  </div>
</template>

<script>


export default {
  data() {
    return {
      dialogFormVisible:false,
      tableData: [],
      data: ''
    }
  },
  methods: {

    get(row) {
      let url = 'http://localhost:8080/allega/getAllage?id=' + row.id
      this.axios.get(url).then((response) => {
        let responseBody = response.data
        if (responseBody.code == 200) {
          console.log(responseBody.data)
          this.data = responseBody.data
          this.dialogFormVisible=true
        } else {
          this.$message({
            showClose: true,
            message: responseBody.message,
            type: 'error'
          });
        }
      });
    },
    loadAllega() {
      let url = 'http://localhost:8080/allega/handleLoadAllega?cardId='+localStorage.getItem('cardId')
      this.axios.get(url).then((response) => {
        let responseBody = response.data
        if (responseBody.code == 200) {
          this.tableData = responseBody.data;
        } else {
          this.$message({
            showClose: true,
            message: responseBody.message,
            type: 'error'
          });
        }
      });

    },
  },
  created() {
    this.loadAllega();
  }
}
</script>

